package com.wanjian.sak.converter;

import android.content.Context;


public class Px2DpSizeConverter   {

    public Size convert(Context context, float length) {
        Size size = new Size();
        size.setLength(px2dp(context, length));
        return size;
    }

    private int px2dp(Context context, float px) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (px / scale + 0.5f);
    }
}
